#tag Class
Protected Class TaskCreator
Inherits Thread
	#tag Event
		Sub Run()
		  
		  Dim theLink As zdTaskListMessenger = zdTaskListWin.RegisterNewTask("Thread creator", "Starting", 0)
		  Dim i As Integer
		  
		  Const kMaxNumberOfThreads = 10
		  
		  For i = 1 to kMaxNumberOfThreads
		    Dim Test As New TestTask
		    
		    theLink.Progress = (i/kMaxNumberOfThreads)*100
		    theLink.State = Str(i) + " Threads created"
		    
		    Test.Run
		    
		    theLink.Progress = zdTaskListMessenger.TaskPaused
		    App.YieldToNextThread
		    //me.Sleep(App.RndGenerator.inRange(250,1500))
		    theLink.Progress = (i/kMaxNumberOfThreads)*100
		    
		  Next
		End Sub
	#tag EndEvent


	#tag ViewBehavior
		#tag ViewProperty
			Name="Index"
			Visible=true
			Group="ID"
			InheritedFrom="Thread"
		#tag EndViewProperty
		#tag ViewProperty
			Name="Left"
			Visible=true
			Group="Position"
			InheritedFrom="Thread"
		#tag EndViewProperty
		#tag ViewProperty
			Name="Name"
			Visible=true
			Group="ID"
			InheritedFrom="Thread"
		#tag EndViewProperty
		#tag ViewProperty
			Name="Priority"
			Visible=true
			Group="Behavior"
			InitialValue="5"
			Type="Integer"
			InheritedFrom="Thread"
		#tag EndViewProperty
		#tag ViewProperty
			Name="StackSize"
			Visible=true
			Group="Behavior"
			InitialValue="0"
			Type="Integer"
			InheritedFrom="Thread"
		#tag EndViewProperty
		#tag ViewProperty
			Name="Super"
			Visible=true
			Group="ID"
			InheritedFrom="Thread"
		#tag EndViewProperty
		#tag ViewProperty
			Name="Top"
			Visible=true
			Group="Position"
			InheritedFrom="Thread"
		#tag EndViewProperty
	#tag EndViewBehavior
End Class
#tag EndClass
